<%--
  Created by IntelliJ IDEA.
  User: 陈俊雄
  Date: 2018/5/16
  Time: 10:20
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<!-- Main view -->
<div class="animated fadeInRight">
    <div class="wrapper wrapper-content ng-scope" ng-controller="merchantMgmtCtrl">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{ 'MERCHANT_MGMT' | translate }}</h5>
                    </div>
                    <div class="ibox-content sk-loading">
                        <div class="sk-spinner sk-spinner-wave">
                            <div class="sk-rect1"></div>
                            <div class="sk-rect2"></div>
                            <div class="sk-rect3"></div>
                            <div class="sk-rect4"></div>
                            <div class="sk-rect5"></div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">商户号：</span>
                                        <input type="text" class="form-control" ng-model="searchInfo.merId">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">商户类型：</span>
                                        <select class="form-control b-r-sm" ng-model="searchInfo.category"
                                                ng-options="x.firstValue as x.name for x in merchantCategory">
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">业务类型：</span>
                                        <select class="form-control b-r-sm" ng-model="searchInfo.refType"
                                                ng-options="x.firstValue as x.name for x in businessType">
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">业务员：</span>
                                        <input type="text" class="form-control" ng-model="searchInfo.salesmanName">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">状态：</span>
                                        <select class="form-control b-r-sm" ng-model="searchInfo.status"
                                                ng-options="x.firstValue as x.name for x in merchantStatus">
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">合同起始日期：</span>
                                        <input type="text"
                                               class="form-control"
                                               ng-readonly="true"
                                               ng-click="openDatepicker1()"
                                               uib-datepicker-popup="{{format}}"
                                               ng-model="searchInfo.startTime"
                                               is-open="popup1.opend"
                                               datepicker-options="dateOptions1"
                                               alt-input-formats="altInputFormats"
                                               close-text="关闭" clear-text="清空" current-text="今天"/>
                                        <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker1()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-1-5">
                                <div class="form-group form-group-sm">
                                    <div class="input-group">
                                        <span class="input-group-addon">合同结束日期：</span>
                                        <input type="text"
                                               class="form-control"
                                               ng-readonly="true"
                                               ng-click="openDatepicker2()"
                                               uib-datepicker-popup="{{format}}"
                                               ng-model="searchInfo.endTime"
                                               is-open="popup2.opend"
                                               datepicker-options="dateOptions2"
                                               alt-input-formats="altInputFormats"
                                               close-text="关闭" clear-text="清空" current-text="今天"/>
                                        <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker2()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 col-md-6 col-lg-3 col-lg-offset-3">
                                <button class="btn btn-sm btn-w-m btn-primary pull-right" ng-click="search(searchInfo)">
                                    查询
                                </button>
                            </div>
                            <div class="col-sm-6 col-md-6 col-lg-3">
                                <button class="btn btn-sm btn-w-m btn-info" ng-click="reset()">
                                    重置
                                </button>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="table-responsive">
                            <table ng-table="merchantTable"
                                   class="table table-condensed table-striped table-hover table-bordered">
                                <tr ng-repeat="row in $data">
                                    <td class="text-center p-6" style="width: 35px">
                                        <input type="radio" name="deleteId" ng-model="selected.id" ng-value="row.merchantInfo.id">
                                    </td>
                                    <td class="text-center" data-title="'商户号'">
                                        {{row.merchantInfo.id}}
                                    </td>
                                    <td class="text-center" data-title="'商户名'">
                                        {{row.merchantInfo.name}}
                                    </td>
                                    <td class="text-center" data-title="'商户类型'">
                                        {{row.merchantInfo.category | getValueByList : merchantCategory : 'firstValue' :
                                        'name'}}
                                    </td>
                                    <td class="text-center" data-title="'联系人'">
                                        {{row.merchantInfo.contacts}}
                                    </td>
                                    <td class="text-center" data-title="'联系电话'">
                                        {{row.merchantInfo.phone}}
                                    </td>
                                    <td class="text-center" data-title="'合同开始'">
                                        {{row.merchantSetting.startTime | date : 'yyyy/MM/dd'}}
                                    </td>
                                    <td class="text-center" data-title="'合同结束'">
                                        {{row.merchantSetting.endTime | date : 'yyyy/MM/dd'}}
                                    </td>
                                    <td class="text-center" data-title="'状态'">
                                        {{row.merchantPay.status == 0 ? '启用' : '禁用'}}
                                    </td>
                                    <td class="text-center p-6" style="width: 340px" data-title="'操作'">
                                        <div style="min-width: 331px">
                                            <button class="btn btn-xs btn-success no-margins"
                                                    ng-click="goMerchantInfo(row)">
                                                基本信息
                                            </button>
                                            <button class="btn btn-xs btn-info" style="margin: 0 0 0 10px"
                                                    ng-click="goMerchantSetting(row)">
                                                配置信息
                                            </button>
                                            <button class="btn btn-xs btn-danger" style="margin: 0 0 0 10px"
                                                    ng-click="goMerchantPay(row)">
                                                支付信息
                                            </button>
                                            <constant-status-btn style="margin: 0 0 0 10px"
                                                                 row="{{row}}"
                                                                 status-constant="{{merchantStatus}}"
                                                                 status-change="statusChange($event, row)"></constant-status-btn>
                                            <button class="btn btn-xs btn-warning" style="margin: 0 0 0 10px"
                                                    ng-click="goMerchantUser(row)">
                                                用户管理
                                            </button>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <button class="btn btn-sm btn-primary pull-left" ng-click="del()" ng-disabled="delDisabled()">
                            删除
                        </button>
                        <my-pagination table-param="merchantTable"></my-pagination>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>